<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('分发办理')"/>
    <th:block th:include="include :: datetimepicker-css"/>
</head>
<body class="white-bg">

<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-standingBook-edit" th:object="${standingBookVo}">
        <input name="id" th:field="*{id}" type="hidden">
        <input name="taskId" th:field="*{taskId}" type="hidden">
        <input type="hidden" name="p_B_outcome"/>
        <input type="hidden" name="saveEntity" value="true"/>
        <h4 class="form-header h4">基本信息</h4>
        <div class="form-group">
            <label class="col-sm-3 control-label ">编号：</label>
            <div class="col-sm-8">
                <input class="form-control" th:field="*{numberText}" type="text" name="numberText" id="numberText"
                       readonly/>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label ">项目名称：</label>
            <div class="col-sm-8">
                <input class="form-control" th:field="*{proName}" type="text" name="proName" id="proName" readonly/>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label ">工程公司：</label>
            <div class="col-sm-8">
                <input class="form-control" th:field="*{compName}" type="text" name="compName" id="compName" readonly/>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label ">商务经理：</label>
            <div class="col-sm-8">
                <input class="form-control" th:value="${createByName}" type="text" name="swjl" id="swjl" readonly/>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label ">审核内容：</label>
            <div class="col-sm-8">
                <input class="form-control" th:field="*{auditContent}" type="text" name="auditContent" id="auditContent"
                       readonly/>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label ">分包班组信息：</label>
            <div class="col-sm-8">
                <input class="form-control" th:field="*{teamInfo}" type="text" name="teamInfo" id="teamInfo" readonly/>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label ">申请金额：</label>
            <div class="col-sm-8">
                <input class="form-control" th:field="*{applyMoney}" type="text" name="applyMoney" id="applyMoney"
                       readonly/>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label ">初审人员：</label>
            <div class="col-sm-8">
                <select class="form-control" id="csry" name="csry"></select>
            </div>
        </div>

        <div class="form-group">
            <div class="col-sm-12" style="text-align: center; margin: 0 auto;">
                <a class="btn btn-success" onclick="ff(1)">提交</a>
                <a class="btn btn-primary" onclick="ff(2)">取消</a>
            </div>
        </div>
    </form>
</div>
<th:block th:include="include :: footer"/>
<th:block th:include="include :: datetimepicker-js"/>
<script th:src="@{/js/activiti.js}"></script>
<script th:inline="javascript">
    var prefix = ctx + "settlement"
    var historyData;

    $(function () {
        var csUserList = [[${csUserList}]]
        console.log(csUserList);
        var html = "<option value=''>请选择初审人员</option>";
        for (var i = 0; i < csUserList.length; i++) {
            html += "<option value='" + csUserList[i].userId + "'>" + csUserList[i].userName + "</option>"
        }
        $("#csry").append(html);

    });

    $("#form-standingBook-add").validate({
        focusCleanup: true
    });

    function submitHandler() {
        $.modal.close();
    }

    function getDataByTitle() {
        var id = $("#last").val();
        for (var i = 0; i < historyData.length; i++) {

            if (historyData[i].id == id) {
                $("#lastPlan").val(historyData[i].nextPlan);
            }
        }
        $("#missmodal1").click();
    }

    function ff(num) {
        if (num == 2) {
            $.modal.close();
        } else {

            if ($("#csry").val() == '') {
                alert("请选择分发人员");
                return false;
            }

            var taskId = [[${taskId}]];


            $('input[name="p_B_outcome"]').val(true);


            if ($.validate.form()) {
                $.operate.save(prefix + "/complete/" + taskId, $('#form-standingBook-edit').serialize());
            }
        }
    }

</script>
</body>
</html>
